home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
graphics
/
highlo.frm
< prev
next >
Wrap
Text File
|
1993-05-16
|
2KB
|
71 lines
VERSION 2.00
Begin Form Form1
Caption = "Daily Highs"
ClientHeight = 4260
ClientLeft = 1095
ClientTop = 1815
ClientWidth = 8205
Height = 4665
Left = 1035
LinkTopic = "Form1"
ScaleHeight = 4260
ScaleWidth = 8205
Top = 1470
Width = 8325
End
Option Explicit
Const PIXEL = 3
Sub Form_Activate ()
Const MAX_TEMP = 110
Const MIN_TEMP = -50
Static DailyHighs(31) As Integer
Dim i As Integer, DaysInMonth As Integer
Dim fhandle As Integer
Dim fname As String
i = 1
fhandle = FreeFile
fname = "c:\vbdemos\graphics\january.dat"
Open fname For Input As fhandle
While Not EOF(fhandle)
Input #fhandle, DailyHighs(i)
i = i + 1
Wend
Close fhandle
'Now that the number of days in the month can be determined,
'set the scale mode of the graph accordingly. The graph thus
'becomes appropriate for charting the temperature.
DaysInMonth = i - 1
form1.ScaleMode = PIXEL
Scale (0, MAX_TEMP)-(DaysInMonth + 1, MIN_TEMP)
'Draw a horizontal line representing 0.
Line (1, 0)-(DaysInMonth + 1, 0)
'Draw the graph.
For i = 2 To DaysInMonth
Line (i - 1, DailyHighs(i - 1))-(i, DailyHighs(i))
Next i
'Print the vertical scale
For i = MAX_TEMP To MIN_TEMP + 20 Step -10
currentx = 0
currenty = i
Print Trim$(Str$(i))
Next i
'Print the horizontal scale
currenty = MIN_TEMP + 10
For i = 1 To DaysInMonth
currentx = i
Print Trim$(Str$(i));
Next i
End Sub